<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Jobs\InboundJob;
use Log;
use InboundService;

/**
 * 从总部获取入库信息到采购系统
 */
class InboundCmd extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'collect:inbound {--type=daily}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'collect inbound';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $type = $this->option('type');
        $params = array(
            'scm_conn' => 'mysql_scm',
            'remote_conn' => 'sqlsrv',
            'type' => $type
        );

        dispatch(new InboundJob($params));
        //InboundService::syncInbound($params['scm_conn'], $params['remote_conn'], $params['type']);
        return 0;
    }
}
